package Interfaz;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JFrame;

import Mundo.Sortings;

public class InterfazPrincipal extends JFrame{

	//-----------------------------------------------------------------
    // Atributos
    //-----------------------------------------------------------------

	private Sortings sort;
	
	//-----------------------------------------------------------------
    // Atributos de la interfaz
    //-----------------------------------------------------------------
	
	private PanelEncabezado panelEncabezado;
	
	private PanelOperaciones panelOperaciones;
	
	//-----------------------------------------------------------------
    // Constructores
    //-----------------------------------------------------------------

	public InterfazPrincipal( )
	{
		sort = new Sortings();
		
		//Construye la forma
		setTitle( "Sistema de Sorting" );
        setSize( 400, 250 );
        setResizable( false );
        setLocationRelativeTo( null );
        setLayout( new GridBagLayout( ) );
        setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        
        // Construir los paneles
        panelEncabezado = new PanelEncabezado( );
        GridBagConstraints gbc = new GridBagConstraints( );
        gbc.gridx = 0;
        gbc.gridy = 0;
        gbc.fill = GridBagConstraints.BOTH;
        add( panelEncabezado, gbc );
        
        panelOperaciones = new PanelOperaciones( this );
        gbc = new GridBagConstraints( );
        gbc.gridx = 1;
        gbc.gridy = 0;
        gbc.fill = GridBagConstraints.BOTH;
        add( panelOperaciones, gbc );
	}
	
	// -----------------------------------------------------------------
    // Métodos
    // -----------------------------------------------------------------
	
	public void generar(int numero)
	{
		sort.generar(numero);
	}
	
	public void sort1(boolean ordenado)
	{
		sort.sort1(ordenado);
	}
	
	public void sort2(boolean ordenado)
	{
		sort.sort2(ordenado);
	}
	//-----------------------------------------------------------------
    // Main
    //-----------------------------------------------------------------
	
	public static void main( String[] args )
    {
		InterfazPrincipal principal = new InterfazPrincipal();
		principal.setVisible(true);
    }


}
